package com.aloda.ojsandbox.exception;

import com.aloda.ojsandbox.pojo.enums.ResponseEnum;
import lombok.Data;

/**
 * @Author aloda
 * @Date 2025/5/2 9:22
 */
@Data
public class BaseException extends RuntimeException {

    private Integer errorCode;

    public BaseException() {
    }

    public BaseException(String message){
        super(message);
        this.errorCode = 0;
    }

    public BaseException(Integer errorCode, String message){
        super(message);
        this.errorCode = errorCode;
    }

    public BaseException(ResponseEnum errorCode){
        super(errorCode.getMessage());
        this.errorCode = errorCode.getStatus();
    }
}
